package com.yztc.orangeentertainment.ui.main.findfragment.findmain;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.TextView;

import com.yztc.orangeentertainment.R;
import com.yztc.orangeentertainment.base.BaseActivity;
import com.yztc.orangeentertainment.config.FindUrlConfig;

import butterknife.ButterKnife;
import butterknife.InjectView;

/**
 * Created by My on 2016/10/15.
 */
public class FindActionActivity extends BaseActivity {
    @InjectView(R.id.findaction_tv)
    TextView findactionTv;
    @InjectView(R.id.findaction_wv)
    WebView findactionWv;
    @InjectView(R.id.findaction_iv)
    ImageView findactionIv;

    private String act;

    @Override
    public int getLayoutId() {
        return R.layout.find_action;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.inject(this);
        initData();
    }

    public void initData() {
        Intent intent = getIntent();
        act = intent.getStringExtra("act");
        //设置webview不能跳转到网页
        findactionWv.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                return false;// 返回false
            }
        });
        //webview加载数据
        findactionWv.loadUrl(FindUrlConfig.ActionPath.FRIST_URL + act + FindUrlConfig.ActionPath
                .LAST_URL);

        findactionTv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

}
